package com.xbongbong.pro.enums;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.xbongbong.saas.enums.XbbRefTypeEnum;
import com.xbongbong.saas.enums.business.AssembleEnum;
import com.xbongbong.saas.enums.business.BomBillEnum;
import com.xbongbong.saas.enums.business.ClueEnum;
import com.xbongbong.saas.enums.business.ContactEnum;
import com.xbongbong.saas.enums.business.ContractEnum;
import com.xbongbong.saas.enums.business.ContractOutstockEnum;
import com.xbongbong.saas.enums.business.CostAdjustEnum;
import com.xbongbong.saas.enums.business.CustomerCommunicateEnum;
import com.xbongbong.saas.enums.business.CustomerManagementEnum;
import com.xbongbong.saas.enums.business.FundTransferEnum;
import com.xbongbong.saas.enums.business.InstockEnum;
import com.xbongbong.saas.enums.business.InventoryEnum;
import com.xbongbong.saas.enums.business.InvoiceEnum;
import com.xbongbong.saas.enums.business.MarketActivityEnum;
import com.xbongbong.saas.enums.business.OtherExpenseEnum;
import com.xbongbong.saas.enums.business.OtherIncomeEnum;
import com.xbongbong.saas.enums.business.OutstockEnum;
import com.xbongbong.saas.enums.business.PaySheetEnum;
import com.xbongbong.saas.enums.business.PaymentSheetEnum;
import com.xbongbong.saas.enums.business.ProductEnum;
import com.xbongbong.saas.enums.business.ProductionInstockEnum;
import com.xbongbong.saas.enums.business.ProductionMaterielOutstockEnum;
import com.xbongbong.saas.enums.business.ProductionOrderEnum;
import com.xbongbong.saas.enums.business.PurchaseEnum;
import com.xbongbong.saas.enums.business.PurchaseInstockEnum;
import com.xbongbong.saas.enums.business.PurchaseInvoiceEnum;
import com.xbongbong.saas.enums.business.QuotationEnum;
import com.xbongbong.saas.enums.business.RefundEnum;
import com.xbongbong.saas.enums.business.RefundInstockEnum;
import com.xbongbong.saas.enums.business.ReturnedMaterielInstockEnum;
import com.xbongbong.saas.enums.business.ReturnedPurchaseEnum;
import com.xbongbong.saas.enums.business.ReturnedPurchaseOutstockEnum;
import com.xbongbong.saas.enums.business.SalesOpportunityEnum;
import com.xbongbong.saas.enums.business.SupplierCommunicateEnum;
import com.xbongbong.saas.enums.business.SupplierContactEnum;
import com.xbongbong.saas.enums.business.SupplierEnum;
import com.xbongbong.saas.enums.business.TransferEnum;
import com.xbongbong.saas.enums.business.WarehouseEnum;
import lombok.Getter;

import java.util.Objects;

/**
 * @author 李翔
 * @date 2023/3/1
 * @description
 */
@Getter
public enum ShareConditionBusinessFieldEnum {


//    ====================  CRM  ====================
    /**
     * 客户管理 - businessType: 100
     */
    CUSTOMER_MANAGEMENT(XbbRefTypeEnum.CUSTOMER_MANAGEMENT.getCode(), new String[]{
            CustomerManagementEnum.NAME.getAttr(), CustomerManagementEnum.PHONE.getAttr(), CustomerManagementEnum.ADDRESS.getAttr(),
            CustomerManagementEnum.TYPE.getAttr(), CustomerManagementEnum.CUSTOMER_STAGE.getAttr(), CustomerManagementEnum.WASTAGE.getAttr(),
            CustomerManagementEnum.WASTAGE_MEMO.getAttr(), CustomerManagementEnum.LABEL.getAttr(), CustomerManagementEnum.GENRE.getAttr(),
            CustomerManagementEnum.IS_INDIVIDUAL.getAttr(), CustomerManagementEnum.SCALE.getAttr(), CustomerManagementEnum.INDUSTRY.getAttr(),
            CustomerManagementEnum.COUNTRY.getAttr(), CustomerManagementEnum.MEMO.getAttr(), CustomerManagementEnum.PARENT.getAttr(),
            CustomerManagementEnum.NAME_SHORT.getAttr(), CustomerManagementEnum.STAGE_RATIO.getAttr(), CustomerManagementEnum.CLUE_ID.getAttr(),
            CustomerManagementEnum.SEX.getAttr(), /*CustomerManagementEnum.BIRTHDAY.getAttr(),*/ CustomerManagementEnum.QQ.getAttr(),
            CustomerManagementEnum.WE_CHRT.getAttr(), CustomerManagementEnum.BACK_NUM.getAttr(), CustomerManagementEnum.LAST_CONNECT_TIME.getAttr(),
            CustomerManagementEnum.SOURCE.getAttr(), CustomerManagementEnum.INSTRUCTION.getAttr(), CustomerManagementEnum.HOBBIES.getAttr(),
            CustomerManagementEnum.WEBSITE.getAttr(),
    }),

    /**
     * 联系人 - businessType: 401
     */
    CONTACT(XbbRefTypeEnum.CONTACT.getCode(), new String[]{
            ContactEnum.NAME.getAttr(), ContactEnum.PHONE.getAttr(), ContactEnum.CUSTOMER_NAME.getAttr(),
            ContactEnum.EMAIL.getAttr(), ContactEnum.ZIP_CODE.getAttr(), ContactEnum.QQ.getAttr(),
            ContactEnum.ADDRESS.getAttr(), ContactEnum.SEX.getAttr(), /*ContactEnum.BIRTHDAY.getAttr(),*/
            ContactEnum.HOBBIES.getAttr(), ContactEnum.MEMO.getAttr(), ContactEnum.DEPARTMENT.getAttr(),
            ContactEnum.POSITION.getAttr(), ContactEnum.LEVEL.getAttr(), ContactEnum.RELATIONSHIP.getAttr(),
    }),

    /**
     * 跟进记录 - businessType: 501
     */
    CUSTOMER_COMMUNICATE(XbbRefTypeEnum.CUSTOMER_COMMUNICATE.getCode(), new String[]{
            CustomerCommunicateEnum.CUSTOMER_NAME.getAttr(), CustomerCommunicateEnum.MEMO.getAttr(), CustomerCommunicateEnum.CONTACT_ARRAY.getAttr(),
            CustomerCommunicateEnum.TYPE.getAttr(), CustomerCommunicateEnum.COMMUNICATE_TIME.getAttr(), CustomerCommunicateEnum.NEXT_NOTIFY_MEMO.getAttr(),
            CustomerCommunicateEnum.CREATOR_ID.getAttr(),
    }),

    /**
     * 销售机会 - businessType: 301
     */
    SALES_OPPORTUNITY(XbbRefTypeEnum.SALES_OPPORTUNITY.getCode(), new String[]{
            SalesOpportunityEnum.NAME.getAttr(), SalesOpportunityEnum.CUSTOMER_NAME.getAttr(), SalesOpportunityEnum.CONTACT_NAME.getAttr(),
            SalesOpportunityEnum.SALE_STAGE.getAttr(), SalesOpportunityEnum.WASTAGE.getAttr(), SalesOpportunityEnum.WASTAGE_MEMO.getAttr(),
            SalesOpportunityEnum.ESTIMATE_AMOUNT.getAttr(), SalesOpportunityEnum.ESTIMATE_END_TIME.getAttr(), SalesOpportunityEnum.COST.getAttr(),
            SalesOpportunityEnum.GROSS_PROFIT.getAttr(), SalesOpportunityEnum.GROSS_PROFIT_RATE.getAttr(), SalesOpportunityEnum.DECISION_MAKER.getAttr(),
            SalesOpportunityEnum.COMPETITOR.getAttr(), SalesOpportunityEnum.STAGE_RATIO.getAttr(), SalesOpportunityEnum.LINK_COMPETITOR.getAttr(),
            SalesOpportunityEnum.WIN_COMPETITOR.getAttr(), /*SalesOpportunityEnum.PRODUCTS.getAttr(),*/
    }),

    /**
     * 报价单 - businessType: 4700
     */
    //关联产品 有缺注意
    QUOTATION(XbbRefTypeEnum.QUOTATION.getCode(), new String[]{
            QuotationEnum.NAME.getAttr(), QuotationEnum.CUSTOMER_NAME.getAttr(), QuotationEnum.CONTACT_ID.getAttr(),
            QuotationEnum.OPPORTUNITY_ID.getAttr(), QuotationEnum.QUOTATION_PERSON.getAttr(), QuotationEnum.QUOTATION_TIME.getAttr(),
            QuotationEnum.EFFECTIVE_TIME.getAttr(), QuotationEnum.STATUS.getAttr(), QuotationEnum.PRODUCT_TOTAL.getAttr(),
            QuotationEnum.DISCOUNT.getAttr(), QuotationEnum.OTHER_EXPENSE.getAttr(), QuotationEnum.DISCOUNT_AMOUNT.getAttr(),
            QuotationEnum.AMOUNT.getAttr(), QuotationEnum.ESTIMATE_COST.getAttr(), QuotationEnum.GROSS_PROFIT.getAttr(),
            QuotationEnum.GROSS_PROFIT_RATE.getAttr(), /*QuotationEnum.PRODUCT.getAttr(),*/
    }),

    /**
     * 合同订单 - businessType: 201
     */
    //关联产品 有缺注意
    CONTRACT(XbbRefTypeEnum.CONTRACT.getCode(), new String[]{
            ContractEnum.NAME.getAttr(), ContractEnum.LINK_CUSTOMER.getAttr(), ContractEnum.LINK_CONTACT.getAttr(),
            ContractEnum.LINK_OPPORTUNITY.getAttr(), ContractEnum.QUOTATION_ID.getAttr(), ContractEnum.SIGN_PERSON.getAttr(),
            ContractEnum.SIGN_TIME.getAttr(), ContractEnum.DEADLINE.getAttr(), ContractEnum.STATUS.getAttr(),
            /*ContractEnum.PRODUCT.getAttr(),*/
            ContractEnum.PRODUCT_TOTAL.getAttr(), ContractEnum.DISCOUNT.getAttr(), ContractEnum.OTHER_EXPENSE.getAttr(),
            ContractEnum.DISCOUNT_AMOUNT.getAttr(), ContractEnum.AMOUNT.getAttr(), ContractEnum.CONTRACT_COST.getAttr(),
            ContractEnum.GROSS_PROFIT.getAttr(), ContractEnum.GROSS_PROFIT_RATE.getAttr(), ContractEnum.CASH_PROFIT.getAttr(),
            ContractEnum.CASH_PROFIT_RATE.getAttr(), ContractEnum.ADD_PAYMENT_SHEET.getAttr(), ContractEnum.ADD_PAYMENT.getAttr(),
            ContractEnum.ADD_WRITE_OFF_PREPAYMENT.getAttr(), ContractEnum.TYPE.getAttr(), ContractEnum.PAY_METHOD.getAttr(),
            ContractEnum.EXPRESS_STATUS.getAttr(), ContractEnum.EXPRESS_NAME.getAttr(), ContractEnum.EXPRESS_NO.getAttr(),
            ContractEnum.SHIP_STATUS.getAttr(), ContractEnum.LINK_PARTNER_CUSTOMER.getAttr(),
    }),

    /**
     * 退货退款 - businessType: 202
     */
    //退货产品、关联产品 有缺  关联产品找不到
    REFUND(XbbRefTypeEnum.REFUND.getCode(), new String[]{
            RefundEnum.REFUND_NAME.getAttr(), RefundEnum.CUSTOMER_ID.getAttr(), RefundEnum.CONTRACT_ID.getAttr(),
            RefundEnum.SIGN_USER.getAttr(), /*RefundEnum.PRODUCTS.getAttr(),*/
            RefundEnum.RETURN_AMOUNT.getAttr(), RefundEnum.REFUND_REASON.getAttr(), RefundEnum.REFUND_STATUS.getAttr(),
            RefundEnum.MEMO.getAttr(), RefundEnum.SIGN_DATE.getAttr(), RefundEnum.PAYMENT_SHEETS.getAttr(),
            RefundEnum.REFUND_AMOUNT.getAttr(), RefundEnum.INVOICES.getAttr(), RefundEnum.PAYMENTS.getAttr(),
    }),

//    ====================  市场管理  ====================
    /**
     * 市场活动 - businessType: 8100
     */
    MARKET_ACTIVITY(XbbRefTypeEnum.MARKET_ACTIVITY.getCode(), new String[]{
            MarketActivityEnum.NAME.getAttr(), MarketActivityEnum.START_TIME.getAttr(), MarketActivityEnum.END_TIME.getAttr(),
            MarketActivityEnum.GENRE.getAttr(), MarketActivityEnum.ESTIMATE_COST.getAttr(), MarketActivityEnum.REAL_COST.getAttr(),
            MarketActivityEnum.ESTIMATE_INCOME.getAttr(), MarketActivityEnum.REAL_INCOME.getAttr(), MarketActivityEnum.LABEL.getAttr(),
            MarketActivityEnum.STATUS.getAttr(), MarketActivityEnum.CAPTION.getAttr(), MarketActivityEnum.ADDRESS.getAttr(),
            MarketActivityEnum.MEMO.getAttr(),
    }),

    /**
     * 线索 - businessType: 8000
     */
    CLUE(XbbRefTypeEnum.CLUE.getCode(), new String[]{
            ClueEnum.COMPANY_NAME.getAttr(), ClueEnum.PHONE.getAttr(), ClueEnum.ADDRESS.getAttr(),
            ClueEnum.MARKET_ACTIVITY_ID.getAttr(), ClueEnum.CLUE_SOURCE.getAttr(), ClueEnum.CLUE_STATUS.getAttr(),
            ClueEnum.CLUE_STAGE.getAttr(), ClueEnum.INVALID_REASON.getAttr(), ClueEnum.INVALID_MEMO.getAttr(),
            ClueEnum.MEMO.getAttr(), ClueEnum.CONTACT.getAttr(), ClueEnum.LABEL.getAttr(),
    }),

//    ====================  资金管理  ====================
    /**
     * 销项发票 - businessType: 901
     */
    INVOICE(XbbRefTypeEnum.INVOICE.getCode(), new String[]{
            InvoiceEnum.INVOICE_NUMBER.getAttr(), InvoiceEnum.APPLY_USER.getAttr(), InvoiceEnum.TOTAL_MONEY.getAttr(),
            InvoiceEnum.CUSTOMER_NAME.getAttr(), InvoiceEnum.CONTRACT_ID.getAttr(), InvoiceEnum.PAYMENT_RELATIONSHIP.getAttr(),
            InvoiceEnum.PAYMENT_ID.getAttr(), InvoiceEnum.PAYMENT_SHEET_ID.getAttr(), InvoiceEnum.INVOICE_DATE.getAttr(),
            InvoiceEnum.INVOICE_TYPE.getAttr(), InvoiceEnum.MEMO.getAttr(),
            InvoiceEnum.CUSTOMER_INVOICE.getAttr(), InvoiceEnum.CUSTOMER_EXPRESS.getAttr(),
    }),

    /**
     * 付款单 - businessType: 802
     */
    PAY_SHEET(XbbRefTypeEnum.PAY_SHEET.getCode(), new String[]{
            PaySheetEnum.PAY_SHEET_TYPE.getAttr(), PaySheetEnum.LINK_SUPPLIER.getAttr(), PaySheetEnum.LINK_PURCHASE.getAttr(),
            PaySheetEnum.PAY_PLAN.getAttr(), PaySheetEnum.AMOUNT.getAttr(), PaySheetEnum.WRITE_OFF_AMOUNT.getAttr(),
            PaySheetEnum.INVOICE_AMOUNT.getAttr(), PaySheetEnum.BELONG_ID.getAttr(), PaySheetEnum.REAL_PAY_TIME.getAttr(),
            PaySheetEnum.FUND_ACCOUNT.getAttr(), PaySheetEnum.PAY_TYPE.getAttr(), PaySheetEnum.MEMO.getAttr(),
    }),

    /**
     * 回款单 - businessType: 702
     */
    PAYMENT_SHEET(XbbRefTypeEnum.PAYMENT_SHEET.getCode(), new String[]{
            PaymentSheetEnum.PAYMENT_SHEET_TYPE.getAttr(), PaymentSheetEnum.CUSTOMER_ID.getAttr(),
            PaymentSheetEnum.CONTRACT.getAttr(), PaymentSheetEnum.PAYMENT.getAttr(), PaymentSheetEnum.AMOUNT.getAttr(),
            PaymentSheetEnum.WRITE_OFF_AMOUNT.getAttr(), PaymentSheetEnum.INVOICE_AMOUNT.getAttr(), PaymentSheetEnum.BELONG_ID.getAttr(),
            PaymentSheetEnum.PAYMENT_TIME.getAttr(), PaymentSheetEnum.PAY_METHOD.getAttr(), PaymentSheetEnum.MEMO.getAttr(),
            PaymentSheetEnum.FUND_ACCOUNT.getAttr(),
    }),

    /**
     * 进项发票 - businessType: 903
     */
    PURCHASE_INVOICE(XbbRefTypeEnum.PURCHASE_INVOICE.getCode(), new String[]{
            PurchaseInvoiceEnum.INVOICE_NUMBER.getAttr(), PurchaseInvoiceEnum.APPLY_USER.getAttr(), PurchaseInvoiceEnum.SUPPLIER_NAME.getAttr(),
            PurchaseInvoiceEnum.PURCHASE_ID.getAttr(), PurchaseInvoiceEnum.PAY_RELATIONSHIP.getAttr(), PurchaseInvoiceEnum.PAY_PLAN_ID.getAttr(),
            /*PurchaseInvoiceEnum.PAY_SHEET_ID.getAttr()*/PurchaseInvoiceEnum.INVOICE_DATE.getAttr(), PurchaseInvoiceEnum.TOTAL_MONEY.getAttr(),
            PurchaseInvoiceEnum.INVOICE_TYPE.getAttr(), PurchaseInvoiceEnum.MEMO.getAttr(),
            PurchaseInvoiceEnum.CUSTOMER_INVOICE.getAttr(), PurchaseInvoiceEnum.CUSTOMER_EXPRESS.getAttr(),
    }),

    /**
     * 资金调拨单 - businessType: 5800
     */
    FUND_TRANSFER(XbbRefTypeEnum.FUND_TRANSFER.getCode(), new String[]{
            FundTransferEnum.AMOUNT.getAttr(), FundTransferEnum.TRANSFER_TIME.getAttr(), FundTransferEnum.OUT_FUND_ACCOUNT.getAttr(),
            FundTransferEnum.IN_FUND_ACCOUNT.getAttr(), FundTransferEnum.PAY_METHOD.getAttr(), FundTransferEnum.MEMO.getAttr(),
    }),

    /**
     * 其他收入单  - businessType: 5710
     */
    OTHER_INCOME(XbbRefTypeEnum.OTHER_INCOME.getCode(), new String[]{
            OtherIncomeEnum.SHEET_TYPE_OTHER.getAttr(), OtherIncomeEnum.AMOUNT.getAttr(), OtherIncomeEnum.INCOME_TIME.getAttr(),
            OtherIncomeEnum.FUND_ACCOUNT.getAttr(), OtherIncomeEnum.PAY_METHOD.getAttr(), OtherIncomeEnum.MEMO.getAttr(),
    }),

    /**
     * 其他支出单  - businessType: 5750
     */
    OTHER_EXPENSE(XbbRefTypeEnum.OTHER_EXPENSE.getCode(), new String[]{
            OtherExpenseEnum.SHEET_TYPE_OTHER.getAttr(), OtherExpenseEnum.AMOUNT.getAttr(), OtherExpenseEnum.EXPENSE_TIME.getAttr(),
            OtherExpenseEnum.FUND_ACCOUNT.getAttr(), OtherExpenseEnum.PAY_METHOD.getAttr(), OtherExpenseEnum.MEMO.getAttr(),
    }),

    //进项发票
    //付款计划
    //临时额度申请记录
    //固定额度申请记录

//    ====================  进销存  ====================

    /**
     * 供应商 - businessType: 1001
     */
    //供货产品 有缺
    SUPPLIER(XbbRefTypeEnum.SUPPLIER.getCode(), new String[]{
            SupplierEnum.SUPPLIER_NAME.getAttr(), SupplierEnum.SHORT_NAME.getAttr(), SupplierEnum.PHONE.getAttr(),
            /*SupplierEnum.THUMBNAIL.getAttr()*/ SupplierEnum.MEMO.getAttr(), /*SupplierEnum.PRODUCT_LIST.getAttr(),*/
            SupplierEnum.ADDRESS.getAttr(), /*SupplierEnum.QUALITY_STANDARD.getAttr(), SupplierEnum.DELIVERY_CAPACITY.getAttr(),
            SupplierEnum.SERVER_CAPACITY.getAttr(),SupplierEnum.CREDIT_LEVEL.getAttr(),SupplierEnum.SUPPLY_COST.getAttr(),*/
            SupplierEnum.REGISTERED_CAPITAL.getAttr(), SupplierEnum.COUNTRY.getAttr(), SupplierEnum.WEBSITE.getAttr(),
            SupplierEnum.ANNUAL_OUTPUT.getAttr(),
    }),

    /**
     * 供应商联系人 - businessType: 1002
     */
    SUPPLIER_CONTACT(XbbRefTypeEnum.SUPPLIER_CONTACT.getCode(), new String[]{
            SupplierContactEnum.NAME.getAttr(), SupplierContactEnum.PHONE.getAttr(),
            SupplierContactEnum.SUPPLIER_ID.getAttr(), SupplierContactEnum.ADDRESS.getAttr(), SupplierContactEnum.EMAIL.getAttr(),
            SupplierContactEnum.QQ.getAttr(), SupplierContactEnum.SEX.getAttr(), /*SupplierContactEnum.BIRTHDAY.getAttr(),*/
            /*SupplierContactEnum.MEMO.getAttr(),*/ SupplierContactEnum.DEPARTMENT.getAttr(), SupplierContactEnum.POSITION.getAttr(),
            SupplierContactEnum.LEVEL.getAttr(),
    }),

    /**
     * 供应商跟进记录 - businessType: 502
     */
    SUPPLIER_COMMUNICATE(XbbRefTypeEnum.SUPPLIER_COMMUNICATE.getCode(), new String[]{
            SupplierCommunicateEnum.SUPPLIER_ID.getAttr(), SupplierCommunicateEnum.SUPPLIER_CONTACT.getAttr(), SupplierCommunicateEnum.TYPE.getAttr(),
            SupplierCommunicateEnum.COMMUNICATE_TIME.getAttr(),
    }),

    /**
     * 采购合同 - businessType: 1101
     */
    //采购产品 有缺
    PURCHASE(XbbRefTypeEnum.PURCHASE.getCode(), new String[]{
            PurchaseEnum.PURCHASE_NAME.getAttr(), PurchaseEnum.SUPPLIER_ID.getAttr(),/* PurchaseEnum.PRODUCT.getAttr(),*/
            PurchaseEnum.PAY_METHOD.getAttr(), PurchaseEnum.STATUS.getAttr(), PurchaseEnum.SIGNER_ID.getAttr(),
            PurchaseEnum.SIGN_TIME.getAttr(), PurchaseEnum.ESTIMATE_ARRIVE_TIME.getAttr(), PurchaseEnum.MEMO.getAttr(),
            PurchaseEnum.PRODUCT_TOTAL.getAttr(), PurchaseEnum.DISCOUNT_MONEY.getAttr(), PurchaseEnum.DISCOUNT_AMOUNT.getAttr(),
            PurchaseEnum.TOTAL_MONEY.getAttr(), PurchaseEnum.ADD_PAYPLAN.getAttr(), PurchaseEnum.ADD_PAY_SHEET.getAttr(),
            PurchaseEnum.ADD_WRITE_OFF_PREPAY.getAttr(), PurchaseEnum.RECEIVE_STATUS.getAttr(),
    }),

    /**
     * 采购退货单 - businessType: 1201
     */
    //退货产品有缺
    RETURNED_PURCHASE(XbbRefTypeEnum.RETURNED_PURCHASE.getCode(), new String[]{
            ReturnedPurchaseEnum.LINK_SUPPLIER.getAttr(), ReturnedPurchaseEnum.PURCHASE_SHEET_ID.getAttr(), ReturnedPurchaseEnum.TIME.getAttr(),
            ReturnedPurchaseEnum.TOTAL_MONEY.getAttr(), ReturnedPurchaseEnum.RETURNED_STATUS.getAttr(), ReturnedPurchaseEnum.MEMO.getAttr(),
            ReturnedPurchaseEnum.PAY_SHEETS.getAttr(), ReturnedPurchaseEnum.RETURNED_PURCHASE_AMOUNT.getAttr(), ReturnedPurchaseEnum.INVOICES.getAttr(),
           /* ReturnedPurchaseEnum.PRODUCTS.getAttr(),*/
    }),

    /**
     * BOM 清单 - businessType: 2601
     */
    //成品产品、物料产品 有缺
    BOM_BILL(XbbRefTypeEnum.BOM_BILL.getCode(), new String[]{
            BomBillEnum.NAME.getAttr(), BomBillEnum.STATUS.getAttr(), BomBillEnum.MEMO.getAttr(),
            BomBillEnum.VERSION.getAttr(), /*BomBillEnum.PRODUCT.getAttr(), BomBillEnum.MATERIEL.getAttr(),*/
    }),

    /**
     * 生产单 - businessType: 2801
     */
    //物料产品、成品产品 有缺
    PRODUCTION_ORDER(XbbRefTypeEnum.PRODUCTION_ORDER.getCode(), new String[]{
            ProductionOrderEnum.BOM_ID.getAttr(), ProductionOrderEnum.BOM_VERSION.getAttr(), ProductionOrderEnum.PLAN_TIME.getAttr(),
            ProductionOrderEnum.MEMO.getAttr(), ProductionOrderEnum.INTO_WAREHOUSE_ID.getAttr(), ProductionOrderEnum.OUT_WAREHOUSE_ID.getAttr(),
            /*ProductionOrderEnum.MATERIEL.getAttr(), ProductionOrderEnum.PRODUCT.getAttr(),*/
    }),

    /**
     * 装配出入库单 - businessType: 1301
     */
    //出库产品、入库产品 有缺
    ASSEMBLE(XbbRefTypeEnum.ASSEMBLE.getCode(), new String[]{
            AssembleEnum.ASSEMBLE_TIME.getAttr(), AssembleEnum.MEMO.getAttr(), AssembleEnum.OUT_WAREHOUSE_ID.getAttr(),
            AssembleEnum.INTO_WAREHOUSE_ID.getAttr(), /*AssembleEnum.OUT_PRODUCTS.getAttr(), AssembleEnum.IN_PRODUCTS.getAttr(),*/
    }),

    /**
     * 盘点单 - businessType: 1701
     */
    //盘点产品 有缺
    INVENTORY(XbbRefTypeEnum.INVENTORY.getCode(), new String[]{
            InventoryEnum.INVENTORY_STATUS.getAttr(), InventoryEnum.INVENTORY_TYPE.getAttr(), InventoryEnum.WAREHOUSE_ID.getAttr(),
            InventoryEnum.TIME.getAttr(), InventoryEnum.MEMO.getAttr(), /*InventoryEnum.PRODUCT.getAttr(),*/
    }),

    /**
     * 调拨单 - businessType: 1601
     */
    TRANSFER(XbbRefTypeEnum.TRANSFER.getCode(), new String[]{
            TransferEnum.STATUS.getAttr(), TransferEnum.TRANSFER_TYPE.getAttr(), TransferEnum.OUT_WAREHOUSE_ID.getAttr(),
            TransferEnum.INTO_WAREHOUSE_ID.getAttr(), TransferEnum.TRANSFER_TIME.getAttr(), TransferEnum.MEMO.getAttr(),
            /*TransferEnum.PRODUCTS.getAttr(),*/
    }),

    /**
     * 成本调整单
     */
    COST_ADJUST(XbbRefTypeEnum.COST_ADJUST.getCode(), new String[] {
            CostAdjustEnum.ADJUST_TIME.getAttr(), CostAdjustEnum.WAREHOUSE_ID.getAttr(), CostAdjustEnum.MEMO.getAttr(),
            /*CostAdjustEnum.PRODUCT.getAttr(),*/
    }),


    /**
     * 仓库 - businessType: 1801
     */
    WAREHOUSE(XbbRefTypeEnum.WAREHOUSE.getCode(), new String[]{
            WarehouseEnum.WAREHOUSE_NAME.getAttr(), WarehouseEnum.ADDRESS.getAttr(), WarehouseEnum.MANAGER_DEP_ID.getAttr(),
            WarehouseEnum.MEMO.getAttr(), WarehouseEnum.ORI_STOCK.getAttr(),/* WarehouseEnum.SENDER_INFORMATION.getAttr(),*/
    }),

    /**
     * 其他入库单 - businessType: 1406
     */
    OTHER_INSTOCK(XbbRefTypeEnum.OTHER_INSTOCK.getCode(), new String[]{
            InstockEnum.WAREHOUSE_ID.getAttr(), InstockEnum.TYPE.getAttr(), InstockEnum.TIME.getAttr(),
            InstockEnum.REF_ID.getAttr(), InstockEnum.MEMO.getAttr(),/* InstockEnum.PRODUCT.getAttr(),*/
    }),

    /**
     * 采购入库单 - businessType: 1404
     */
    PURCHASE_INSTOCK(XbbRefTypeEnum.PURCHASE_INSTOCK.getCode(), new String[]{
            PurchaseInstockEnum.SUPPLIER_ID.getAttr(), PurchaseInstockEnum.WAREHOUSE_ID.getAttr(), PurchaseInstockEnum.TIME.getAttr(),
            PurchaseInstockEnum.REF_ID.getAttr(), PurchaseInstockEnum.MEMO.getAttr(),/* PurchaseInstockEnum.PRODUCT.getAttr(),*/
    }),

    /**
     * 销售退货入库单 - businessType: 1405
     */
    REFUND_INSTOCK(XbbRefTypeEnum.REFUND_INSTOCK.getCode(), new String[]{
            RefundInstockEnum.CUSTOMER_ID.getAttr(), RefundInstockEnum.WAREHOUSE_ID.getAttr(), RefundInstockEnum.TIME.getAttr(),
            RefundInstockEnum.REF_ID.getAttr(), RefundInstockEnum.PRODUCT_TOTAL.getAttr(), RefundInstockEnum.OTHER_EXPENSE.getAttr(),
            RefundInstockEnum.TOTAL_MONEY.getAttr(), RefundInstockEnum.MEMO.getAttr(), /*RefundInstockEnum.PRODUCT.getAttr(),*/
    }),


    /**
     * 生产入库单 - businessType: 1407
     */
    PRODUCTION_INSTOCK(XbbRefTypeEnum.PRODUCTION_INSTOCK.getCode(), new String[]{
            ProductionInstockEnum.WAREHOUSE_ID.getAttr(), ProductionInstockEnum.TIME.getAttr(), ProductionInstockEnum.REF_ID.getAttr(),
            ProductionInstockEnum.MEMO.getAttr(), /*ProductionInstockEnum.PRODUCT.getAttr(),*/
    }),

    /**
     * 生产退料单 - businessType: 1408
     */
    RETURNED_MATERIEL_INSTOCK(XbbRefTypeEnum.RETURNED_MATERIEL_INSTOCK.getCode(), new String[]{
            ReturnedMaterielInstockEnum.WAREHOUSE_ID.getAttr(), ReturnedMaterielInstockEnum.TIME.getAttr(), ReturnedMaterielInstockEnum.REF_ID.getAttr(),
            ReturnedMaterielInstockEnum.MEMO.getAttr(), /*ReturnedMaterielInstockEnum.PRODUCT.getAttr(),*/
    }),

    /**
     * 其他出库单 - businessType: 1506
     */
    OTHER_OUTSTOCK(XbbRefTypeEnum.OTHER_OUTSTOCK.getCode(), new String[]{
            OutstockEnum.TIME.getAttr(), OutstockEnum.TYPE.getAttr(), OutstockEnum.WAREHOUSE_ID.getAttr(),
            OutstockEnum.REF_ID.getAttr(), OutstockEnum.EXPRESS_NAME.getAttr(), OutstockEnum.EXPRESS_NO.getAttr(),
            OutstockEnum.MEMO.getAttr(),/* OutstockEnum.PRODUCT.getAttr(),*/
    }),

    /**
     * 销售出库单 - businessType: 1504
     */
    CONTRACT_OUTSTOCK(XbbRefTypeEnum.CONTRACT_OUTSTOCK.getCode(), new String[]{
            ContractOutstockEnum.TIME.getAttr(), ContractOutstockEnum.LINK_CUSTOMER.getAttr(), ContractOutstockEnum.WAREHOUSE_ID.getAttr(),
            ContractOutstockEnum.REF_ID.getAttr(), ContractOutstockEnum.EXPRESS_NAME.getAttr(), ContractOutstockEnum.EXPRESS_NO.getAttr(),
            ContractOutstockEnum.PRODUCT.getAttr(), ContractOutstockEnum.PRODUCT_TOTAL.getAttr(), ContractOutstockEnum.OTHER_EXPENSE.getAttr(),
            ContractOutstockEnum.TOTAL_MONEY.getAttr(), ContractOutstockEnum.CUSTOMER_PHONE.getAttr(), ContractOutstockEnum.CUSTOMER_ADDRESS.getAttr(),
            ContractOutstockEnum.MEMO.getAttr(), ContractOutstockEnum.WHOLE_ORDE_DISCOUNT_RATE.getAttr(), ContractOutstockEnum.DISCOUNT_AMOUNT.getAttr(),
    }),

    /**
     * 采购退货出库单 - businessType: 1505
     */
    RETURNED_PURCHASE_OUTSTOCK(XbbRefTypeEnum.RETURNED_PURCHASE_OUTSTOCK.getCode(), new String[]{
            ReturnedPurchaseOutstockEnum.TIME.getAttr(), ReturnedPurchaseOutstockEnum.LINK_SUPPLIER.getAttr(), ReturnedPurchaseOutstockEnum.WAREHOUSE_ID.getAttr(),
            ReturnedPurchaseOutstockEnum.REF_ID.getAttr(), ReturnedPurchaseOutstockEnum.EXPRESS_NAME.getAttr(), ReturnedPurchaseOutstockEnum.EXPRESS_NO.getAttr(),
            ReturnedPurchaseOutstockEnum.MEMO.getAttr(), /*ReturnedPurchaseOutstockEnum.PRODUCT.getAttr(),*/
    }),

    /**
     * 生产领料单 - businessType: 1507
     */
    PRODUCTION_MATERIEL_OUTSTOCK(XbbRefTypeEnum.PRODUCTION_MATERIEL_OUTSTOCK.getCode(), new String[]{
            ProductionMaterielOutstockEnum.TIME.getAttr(), ProductionMaterielOutstockEnum.WAREHOUSE_ID.getAttr(), ProductionMaterielOutstockEnum.REF_ID.getAttr(),
            ProductionMaterielOutstockEnum.EXPRESS_NAME.getAttr(), ProductionMaterielOutstockEnum.EXPRESS_NO.getAttr(), ProductionMaterielOutstockEnum.MEMO.getAttr(),
            /*ProductionMaterielOutstockEnum.PRODUCT.getAttr(),*/
    }),

//    ====================  产品  ====================
    /**
     * 产品 - businessType: 2401
     */
/*    PRODUCT(XbbRefTypeEnum.PRODUCT.getCode(), new String[]{
            ProductEnum.NAME.getAttr(), ProductEnum.BARCODE.getAttr(), ProductEnum.SUPPLIER.getAttr(),
            ProductEnum.WAREHOUSE.getAttr(), ProductEnum.CATEGORY_ID.getAttr(), ProductEnum.SPECIFICATION.getAttr(),
            ProductEnum.VISBLE_DEPT.getAttr(), ProductEnum.VISBLE_USER.getAttr(), ProductEnum.UNIT.getAttr(),
            ProductEnum.ENABLE_MULTI_UNIT.getAttr(), ProductEnum.COST.getAttr(), ProductEnum.INSTRUCTION.getAttr(),
            ProductEnum.STOCK.getAttr(), ProductEnum.ONLINE_TIME.getAttr(), ProductEnum.ENABLE_BATCH_SHELF_LIFE.getAttr(),
            ProductEnum.SHELF_LIFE_DAYS.getAttr(), ProductEnum.EXPIRATION_ALERT_DAYS.getAttr(), ProductEnum.STOCK_NOTIFY.getAttr(),
    }),*/

    //    ====================  新工单  ====================
    // 工单
    WORK_ORDER_V2(XbbRefTypeEnum.WORK_ORDER_V2.getCode(), new String[]{
            "serialNo", "text_1", "text_2", "subForm_1", "text_3", "date_1", "date_2", "address_1", "array_1", "text_4",
            "text_5", "date_3", "date_4", "date_5", "num_7", "text_7", "date_7", "text_8", "text_9", "text_10", "num_2", "text_11", "num_3", "num_4",
    }),
    // 回执单
    RECEIPT_ORDER(XbbRefTypeEnum.RECEIPT_ORDER.getCode(), new String[]{
            "text_1", "text_2", "text_3", /*"array_1",*/ "array_2", "num_1", "num_2", "num_3", "text_5", "num_4",
    }),
    // 服务项目
    SERVICE_PROJECT(XbbRefTypeEnum.SERVICE_PROJECT.getCode(), new String[]{
            "text_1", "text_2", "num_1", "num_2", "array_29", "array_30", "date_1",
    });

    /**
     * 业务类型
     */
    private final int code;

    /**
     * 字段数组
     */
    private final String[] attrArray;

    ShareConditionBusinessFieldEnum(int code, String[] attrArray) {
        this.code = code;
        this.attrArray = attrArray;
    }

    /**
     * 根据业务类型查询所有字段
     *
     * @param code 业务类型
     * @return 该业务支持的所有字段
     */
    public static JSONArray getAttrsByCode(Integer code) {
        JSONArray array = new JSONArray();
        for (ShareConditionBusinessFieldEnum cacheCode : values()) {
            if (Objects.equals(code, cacheCode.getCode())) {
                String[] attrArray = cacheCode.getAttrArray();
                array = JSONArray.parseArray(JSON.toJSONString(attrArray));
                return array;
            }
        }
        return array;
    }
}
